t=0
for i in range(10):
    if i%3 and i%8:
        t+=i
print(t)        
